package com.heima.behavior.controller.v1;

import com.heima.behavior.service.BehaviorService;
import com.heima.model.behavior.dtos.LikeBehaviorDTO;
import com.heima.model.behavior.dtos.ReadBehaviorDto;
import com.heima.model.behavior.dtos.UnLikeBehaviorDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author:Dikk
 * @create: 2023-08-02 14:55
 * @Description: BehaviorController
 */
@RestController
@RequestMapping("/api/v1")
public class BehaviorController {

    @Autowired
    private BehaviorService behaviorService;

    /**
     * 不喜欢
     * @param dto
     * @return
     */
    @PostMapping("/un_likes_behavior/")
    public ResponseResult unLike(@RequestBody UnLikeBehaviorDto dto){
    return behaviorService.unLikeBehavior(dto);
    }


    /**
     * 阅读数量
     * @param readBehaviorDto
     * @return
     */
    @PostMapping("/read_behavior")
    public ResponseResult readBehavior(@RequestBody ReadBehaviorDto readBehaviorDto){
        return behaviorService.readBehavior(readBehaviorDto);
    }
    /**
     * 点赞行为
     *
     * @param likeBehaviorDTO
     * @return
     */
    @PostMapping("/likes_behavior")
    public ResponseResult likesBehavior(@RequestBody LikeBehaviorDTO likeBehaviorDTO) {
        return behaviorService.likesBehavior(likeBehaviorDTO);
    }


}
